package org.example.struct.array;

import java.util.Arrays;

/**
 * @author liyishan
 * @date 2024/8/5 10:34
 * @apiNote
 */

public class Test00561ArrayPairSum {
    public int arrayPairSum(int[] nums) {
        Arrays.sort(nums);
        int sum = 0;
        for(int i = 0;i<nums.length;i+=2){
            sum+=nums[i];
        }
        return sum;
    }
}
